/*
 * Created by Jaren at 2022/11/23 16:49
 */
import 'package:inmotion_protocol/ezcan/bean/euc/real_time_data.dart';
import 'package:inmotion_protocol/ezcan/bean/real_time_info.dart';
import 'package:inmotion_protocol/ezcan/bean/statistics.dart';
import 'package:inmotion_protocol/ezcan/protocol.dart';

class V5HistoryStatistics extends EzCANHistoryStatistics {}

class V5TotalStatistics extends EzCANTotalStatistics {}

class V8HistoryStatistics extends V5HistoryStatistics {}

class V8TotalStatistics extends V5TotalStatistics {}

class V10LikeHistoryStatistics extends EzCANHistoryStatistics {
  @override
  void calculate(AbsRealTimeInfo realTimeInfo, StatisticsMocker statisticsMocker) {
    realTimeInfo as V10LikeRealTimeInfo;
    mileage = realTimeInfo.mileage;
    rideTime = realTimeInfo.rideTime;

    /// V10Like中，直接使用实时数据中的maxSpeed
    maxSpeed = realTimeInfo.maxSpeed;
  }

  @override
  String toString() {
    return 'V10LikeHistoryStatistics {mileage: ${mileage.value}, ride time: ${rideTime.value}, energy: ${energy.value}, max mos temp: ${maxMosTemp.value}, max power: ${maxPower.value}, max speed: ${maxSpeed.value} }';
  }
}

class V10LikeTotalStatistics extends EzCANTotalStatistics {
  @override
  void fromRealTimeInfo(AbsRealTimeInfo realTimeInfo) {
    super.fromRealTimeInfo(realTimeInfo);
    realTimeInfo as V10LikeRealTimeInfo;
    energy = realTimeInfo.totalEnergy;
  }

  @override
  String toString() {
    return 'V10LikeTotalStatistics{mileage: ${mileage.value}, energy: ${energy.value}';
  }
}
